﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using BLL;

namespace Sales
{
    public partial class frmFileName : Form
    {
      


        public frmFileName()
        {
            InitializeComponent();
            MiddleModule.eventSend += new Send(MiddleModule_eventSend);
        }
        private static frmFileName frmfileName = null;
        public static frmFileName CreateInstance()
        {
            if (null == frmfileName)
            {
                frmfileName = new frmFileName();
            }
            return frmfileName;
        }


        void MiddleModule_eventSend(object sender, object receiver, object msg)
        {
            DateReport dateReport = sender as DateReport;
            //数据来源 日报表页面
            if (null != dateReport && frmfileName.ToString() == receiver.ToString())
            {
                this.txtFileName.Text = msg.ToString();
            }
        }

 
        private void gbtnQd_Click(object sender, EventArgs e)
        {
            string fileName = this.txtFileName.Text;
            if (fileName == "")
            {
                MessageBox.Show("文件名不能为空");
            }
            else
            {
                DateReport dateReport = DateReport.CreateInstance();
                MiddleModule.SendMessage(this, dateReport, fileName);
                frmfileName = null;
                this.Close();
            }
        }

    }
}
